<div class="portlet light bordered order-list-container" style="margin: 15px;">
	<div class="portlet-title">
		<div class="caption">
			<span class="caption-subject bold"> Order List </span>
		</div>
		<div class="actions">
			<button type="button" class="btn blue" ng-click="batchUpdateOrder()" permission-check="{{'outbound::batchOrderUpdate_write'}}" >Batch Update Order</button> |
			<button type="button" class="btn blue" ng-click="batchPrePrintShippingLabel()" >Batch Pre-Print Shipping Label</button> |
			<button type="button" class="btn blue" ng-click="longHaul()">LH Monitor</button> |
			<button type="button" class="btn blue" ng-click="syncedToHon()">Sync Orders To Hon</button> |
			<a ui-sref="wms.outbound.order.add"  permission-check="{{'outbound::order_write'}}"><b>Add Order</b></a>
		</div>
	</div>
	<div class="portlet-body form form-horizontal">
		<order-search-form is-loading="searchLoading" need-export="true" is-exporting="exporting" export-order="export(searchParam)"
						   order="searchParam" search-orders="searchOrders(searchParam)"
						   need-batch-close="true" is-batch-close="isBatchClosing" batch-close-order="batchCloseOrder()">
		</order-search-form>
		<div ng-show="isLoading" class="text-center">
			<img src="assets/img/loading-spinner-grey.gif"><span>&nbsp;LOADING...</span>
		</div>
		<div class="table-scrollable item-list-continer">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>
							<input type="checkbox" ng-click="checkAllOrders()" ng-checked="selectAllIsChecked()" name="selectAll" />
						</th>
						<th ng-repeat="col in columnDefs track by $index"
							class="{{getSortClass($index)}}"
							ng-click="sortClick($index)">
							{{col.headerName}}
						</th>
						<th ng-if="columnDefs"  permission-check="{{'outbound::order_write'}}">Actions</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="item in orders">
						<td class="ribbon ribbon-color-info uppercase" ng-click="checkOrder(item)">
							<input type="checkbox" ng-checked="isChecked(item)"  >
						</td>
						<td><a ng-href="{{'#/wms/outbound/order/' + item.id}}" target="_blank">{{item.id}}</a></td>
						<td><span ng-repeat="entryId in item.entryIds"><a ng-href="{{'#/cf/facility/window/checkin/' + entryId + '/' + entryId + '/carrier-info'}}" target="_blank">{{entryId}}</a>	<span ng-show="!$last">,&nbsp;</span></span></td>
						<td>
							<a ng-href="{{'#/wms/outbound/order-plan/view/' + item.orderPlanId}}" target="_blank">{{item.orderPlanId}}</a>
						</td>
						<td ng-class="{'font-red':item.status == 'Commit Blocked' || item.status === 'Commit Failed'}">
							{{item.status}}
						</td>
						<td>{{item.orderType}}</td>
						<td>
							<span ng-repeat="load in item.loads track by $index">
								<a ng-href="{{'#/wms/outbound/load/' + load.id}}" target="_blank">{{load.loadNo}}
									</a>
								<span ng-show="!$last">,&nbsp;</span>
							</span>
						</td>
						<td>{{item.customerName}}</td>
						<td>{{item.shipToAddress.organizationName}}</td>
						<td>{{item.shipToAddress.name}}</td>
						<td>{{item.referenceNo}}</td>
						<td>{{item.poNo}}</td>
						<td><span ng-repeat="soNo in item.soNos">
						{{soNo}}&nbsp;
						 </span></td>
						<td>{{item.mabd | amDateFormat:'YYYY-MM-DD HH:00'}}</td>
						<!--<td>{{item.scheduleDate | amDateFormat:'YYYY-MM-DD'}}</td>-->
						<td>{{item.carrierName}}</td>
						<td>{{item.retailerName}}</td>
						<td>{{item.freightTerm}}</td>
						<td>{{item.syncStatu ?'Yes':'No'}}</td>
						<td>{{item.isRush?'Yes':'No'}}</td>
						<td>{{item.attemptedCommitDate | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
						<td>{{item.createdWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}
							<span ng-show="item.createdBy">({{item.createdBy}})</span></td>
						<td>{{item.updatedWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}
							<span ng-show="item.updatedBy">({{item.updatedBy}})</span></td>
						<td  permission-check="{{'outbound::order_write'}}" class="table-btn">

							<waitting-btn  type="button" btn-class="btn" ng-click="singleAsynOrderToHon(item,$index)"
								value="'Sync To Hon'" is-loading="aysnToHonLoads[$index]"></waitting-btn>
							<button  class="btn red" ng-show="item.status === 'Imported' || item.status === 'Open'"
							   ng-click="deleteOrder(item.id)" title="Delete">Delete</button>
						</td>
					</tr>
					</tbody>
			</table>
		</div>
		<pager total-count="paging.totalCount" current-page ="paging.pageNo"  page-size="pageSize"  load-content="loadContent(currentPage)"></pager>
	</div>
</div>
